package cn.dengl.sky.springboot.common.config.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * @program: springboot
 * @description:
 * @author: dengl
 * @create: 2018-09-18 13:29
 */
public class UUIDUtil {
    /*UUID*/
    public static String getUUID(){
       String uuid= UUID.randomUUID().toString().replace("-","");
        return uuid;

    }
//    19位数字加字母
    public static  String getOrderNo(){
        String orderNo = "" ;
        UUID uuid = UUID.randomUUID();
        String trandNo = String.valueOf((Math.random() * 9 + 1) * 1000000);
        String sdf = new SimpleDateFormat("yyyyMMddHHMMSS").format(new Date());

        orderNo = uuid.toString().substring(0, 8);
        orderNo = orderNo + sdf ;
        return orderNo ;
    }
    //19位随机纯数字
    public static String getCaseNo(){
        String orderNo = "" ;
        String trandNo = String.valueOf((Math.random() * 9 + 1) * 1000000);
        String sdf = new SimpleDateFormat("yyyyMMddHHMMSS").format(new Date());
        orderNo = trandNo.toString().substring(0, 4); orderNo = orderNo + sdf ;
        return orderNo ;
    }
    public static void main(String src[]){
        System.out.println(getUUID());
        System.out.println(getCaseNo());

    }
}
